package com.sbr.seb.rule.entity;

import javax.persistence.Entity;
import javax.persistence.Id;

import com.sbr.seb.rule.Specification;
import com.sbr.seb.rule.exception.SpecificationException;

@Entity
public class PersistedSpecification<T> implements Specification<T> {

	@Id
	private int id;
	private Specification<T> specification;
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public Specification<T> getSpecification() {
		return specification;
	}
	
	public void setSpecification(Specification<T> specification) {
		this.specification = specification;
	}

	@Override
	public boolean isSatisfiedBy(T candidate) throws SpecificationException {
		return specification.isSatisfiedBy(candidate);
	}
	
	
	
}
